#ifndef TRIANGLE_H
#define TRIANGLE_H

#include <QDebug>
#include <QElapsedTimer>
#include <QExpandOpenGLWidget>
#include <memory>

class Triangle : public QExpandOpenGLWidget
{
public:
    Triangle();
    ~Triangle();
    //键盘按下事件
    void keyPressEvent(QKeyEvent *event);
    // 鼠标事件
    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent* event);
    void mouseMoveEvent(QMouseEvent* event);
    void wheelEvent(QWheelEvent *event);

protected:
    virtual void initializeGL();
    virtual void resizeGL(int w, int h);
    virtual void paintGL();
private:
    QElapsedTimer time;
    std::shared_ptr<Shader> shader = nullptr;
    std::shared_ptr<Shader> lightShader = nullptr;
    // lighting
    glm::vec3 lightPos;
    unsigned int texture1, texture2;
};

#endif // TRIANGLE_H
